{%include file="index.header.tpl.php"%}
{%include file="index.left.tpl.php"%}
  <!--主要内容开始-->
  <div class="content-wrapper">
    <section class="content">
      <div class="row">
        <section class="col-lg-12 connectedSortable">
         <div class="box box-default box-solid">
             <form id="i18nform" action="" method="post">
               <div class="box-header with-border" style="padding-left:0px;">
                    <div class="col-sm-3" style="width:200px;">
                        <span class="fa fa-table" style="float:left; font-size:18px; margin-top:2px; color:#3c8dbc;" ></span>
                        <p class="box-title">教师值日表</p> 
                     </div>
                     <div class="col-sm-6">
                              <label  class="col-sm-3 control-label">
                                   生效日期：
                              </label>
                              <div class="input-group col-sm-5" style="float:left; margin-right:8px;">
                                  <input type="text" class="form-control" name="start_time" value="{%$start_time%}" id="day">
                                   <div class="input-group-addon">
                                        <i class="fa fa-calendar"></i>
                                    </div>
                              </div> 
                              <button type="submit" class="btn btn-default">确 定</button>
                     </div>
                </div> 
                <div class="box-body">
                      <div style="width:100%; overflow-x:scroll; padding-top:10px;">
                         <input type="button" class="btn btn-success" name="xx" onclick="addNewRow();" value="增加行"/>
                          <input type="button" class="btn btn-warning" name="yy" onclick="removeRow();" value="删除行"/>
                                 <table class="table-bordered" id="box" style="margin-bottom:0px; margin-top:6px; width:1800px;"> 
                                     <thead>
                                         <tr style="width:1800px;">
                                                <td rowspan="2" style="width:50px;">选择</td>
                                                <td rowspan="2" style="width:180px;">地点</td>
                                                <td colspan="2" align="center">星期一</td>
                                                <td colspan="2" align="center">星期二</td>
                                                <td colspan="2" align="center">星期三</td>
                                                <td colspan="2" align="center">星期四</td>
                                                <td colspan="2" align="center">星期五</td>
                                                <td colspan="2" align="center">星期六</td>        
                                         </tr>
                                         <tr>
                                                <td style="width:130px">上午</td>
                                                <td style="width:130px">下午</td>
                                                <td style="width:130px">上午</td>
                                                <td style="width:130px">下午</td>
                                                <td style="width:130px">上午</td>
                                                <td style="width:130px">下午</td>
                                                <td style="width:130px">上午</td>
                                                <td style="width:130px">下午</td>
                                                <td style="width:130px">上午</td>
                                                <td style="width:130px">下午</td>
                                                <td style="width:130px">上午</td>
                                                <td style="width:130px">下午</td>   
                                         </tr>
                                    </thead>
                               </table>
                              <table class="table-bordered" id="myTab" style="width:1800px; margin-bottom:10px;"> 
							   {%foreach from=$data_check key=kk item=vv%}
                                   <tr>
                                    <td class="top-bt liebiao-c" style="width:50px;"> 
									{%if $kk != '0'%}
									     <input type='checkbox' name='chkArr' id='chkArr{%$kk%}' />
                                        <input type="hidden" id="mark" value="{%$kk%}">
									{%/if%}
									</td>
                                    <td class="top-bt liebiao-c" style="width:180px;"><input type="text" name="ar_{%$kk%}" value="{%$vv.area%}"></td>
                                     <td class="top-bt liebiao-c" style="width:130px">
                                     <select name="dy1_1_{%$kk%}"  style="width:100px;">
										  {%foreach from=$staff_lists key=key item=value%}
                                          <option value="{%$value.staff_id%}" {%if $value.staff_id==$vv.dy1_1%}selected{%/if%}> {%$value.staff_name%}</option>
										  {%/foreach%}
                                       </select>
                                    </td>
                                     <td class="top-bt liebiao-c" style="width:130px">
                                       <select name="dy1_2_{%$kk%}"  style="width:100px;">
										  {%foreach from=$staff_lists key=key item=value%}
                                          <option value="{%$value.staff_id%}" {%if $value.staff_id==$vv.dy1_2%}selected{%/if%}> {%$value.staff_name%}</option>
										  {%/foreach%}
                                       </select>
                                    </td>
                                     <td class="top-bt liebiao-c" style="width:130px">
                                       <select name="dy2_1_{%$kk%}"  style="width:100px;">
										  {%foreach from=$staff_lists key=key item=value%}
                                          <option value="{%$value.staff_id%}" {%if $value.staff_id==$vv.dy2_1%}selected{%/if%}> {%$value.staff_name%}</option>
										  {%/foreach%}
                                       </select>
                                    </td>
                                    <td class="top-bt liebiao-c" style="width:130px">
                                       <select name="dy2_2_{%$kk%}"  style="width:100px;">
										  {%foreach from=$staff_lists key=key item=value%}
                                          <option value="{%$value.staff_id%}" {%if $value.staff_id==$vv.dy2_2%}selected{%/if%}> {%$value.staff_name%}</option>
										  {%/foreach%}
                                       </select>
                                    </td>
                                    <td class="top-bt liebiao-c" style="width:130px">
                                       <select  name="dy3_1_{%$kk%}"  style="width:100px;">
										  {%foreach from=$staff_lists key=key item=value%}
                                          <option value="{%$value.staff_id%}" {%if $value.staff_id==$vv.dy3_1%}selected{%/if%}> {%$value.staff_name%}</option>
										  {%/foreach%}
                                       </select>
                                    </td>
                                    <td class="top-bt liebiao-c" style="width:130px">
                                       <select  name="dy3_2_{%$kk%}"  style="width:100px;">
										  {%foreach from=$staff_lists key=key item=value%}
                                          <option value="{%$value.staff_id%}" {%if $value.staff_id==$vv.dy3_2%}selected{%/if%}> {%$value.staff_name%}</option>
										  {%/foreach%}
                                       </select>
                                    </td>
                                     <td class="top-bt liebiao-c" style="width:130px">
                                       <select  name="dy4_1_{%$kk%}"  style="width:100px;">
										  {%foreach from=$staff_lists key=key item=value%}
                                          <option value="{%$value.staff_id%}" {%if $value.staff_id==$vv.dy4_1%}selected{%/if%}> {%$value.staff_name%}</option>
										  {%/foreach%}
                                       </select>
                                    </td>
                                     <td class="top-bt liebiao-c" style="width:130px"> 
                                       <select  name="dy4_2_{%$kk%}"  style="width:100px;">
										  {%foreach from=$staff_lists key=key item=value%}
                                          <option value="{%$value.staff_id%}" {%if $value.staff_id==$vv.dy4_2%}selected{%/if%}> {%$value.staff_name%}</option>
										  {%/foreach%}
                                       </select>
                                    </td>
                                    <td class="top-bt liebiao-c" style="width:130px">
                                       <select  name="dy5_1_{%$kk%}"  style="width:100px;">
										  {%foreach from=$staff_lists key=key item=value%}
                                          <option value="{%$value.staff_id%}" {%if $value.staff_id==$vv.dy5_1%}selected{%/if%}> {%$value.staff_name%}</option>
										  {%/foreach%}
                                       </select>
                                    </td>
                                     <td class="top-bt liebiao-c" style="width:130px">
                                       <select  name="dy5_2_{%$kk%}"  style="width:100px;">
										  {%foreach from=$staff_lists key=key item=value%}
                                          <option value="{%$value.staff_id%}" {%if $value.staff_id==$vv.dy5_2%}selected{%/if%}> {%$value.staff_name%}</option>
										  {%/foreach%}
                                       </select>
                                    </td>
                                     <td class="top-bt liebiao-c" style="width:130px">
                                       <select  name="dy6_1_{%$kk%}"  style="width:100px;">
										  {%foreach from=$staff_lists key=key item=value%}
                                          <option value="{%$value.staff_id%}" {%if $value.staff_id==$vv.dy6_1%}selected{%/if%}> {%$value.staff_name%}</option>
										  {%/foreach%}
                                       </select>
                                    </td>
                                    <td class="top-bt liebiao-c" style="width:130px">
                                       <select  name="dy6_2_{%$kk%}"  style="width:100px;">
										  {%foreach from=$staff_lists key=key item=value%}
                                          <option value="{%$value.staff_id%}" {%if $value.staff_id==$vv.dy6_2%}selected{%/if%}> {%$value.staff_name%}</option>
										  {%/foreach%}
                                       </select>
                                    </td>
                               </tr>
							   {%/foreach%}
                        </table>  
                        </div>
				    </div><!--box-body -->
                    <div class="box-footer">
                         <div class="form-group">
                              <label for="inputPassword3" class="col-sm-4 control-label text-right" style="font-weight:500;">
                                   是否含周六：
                              </label>
                              <div class="col-md-2">
                                      <label class="choice"><input type="radio" name="week_end" value="1" {%if $w=='5'%}checked{%/if%}> 是</label>
                                      <label class="choice"><input type="radio" name="week_end" value="0" {%if $w!='5'%}checked{%/if%}> 否</label>
                              </div>
                              <div class="col-md-6">
                                     <button class="btn btn-primary" type="submit"> 确 定</button>
                              </div> 
				         </div>
                    </div> 
                  </form>
             </div><!--box box-default box-solid-->
          </section>   
        </div><!--row-->
    </section>
 </div>
  {%include file="index.footer.tpl.php"%}
<script>
  $(function(){
    $( "#day" ).datepicker({
      changeMonth: true,
	  changeYear: true,
      });
	})
</script>
<style type="text/css">
select option{ height:26px;}
</style>
<script language="javascript">
 //窗口表格增加一行
  function addNewRow(){
   var tabObj=document.getElementById("myTab");//获取添加数据的表格
   var rowsNum = tabObj.rows.length;  //获取当前行数
   var colsNum=tabObj.rows[rowsNum-1].cells.length;//获取行的列数
   var myNewRow = tabObj.insertRow(rowsNum);//插入新行
   var newTdObj1=myNewRow.insertCell(0);
   newTdObj1.innerHTML="<input type='checkbox' name='chkArr' id='chkArr'"+rowsNum+" />";
   var newTdObj2=myNewRow.insertCell(1);
   newTdObj2.innerHTML="<input type='text' name='ar_"+rowsNum+"' id='nodecode'"+rowsNum+" value=''/>";
   var newTdObj3=myNewRow.insertCell(2);
   newTdObj3.innerHTML="<select style='padding:0px; width:100px' name='dy1_1_"+rowsNum+"'>{%foreach from=$staff_lists key=key item=value%}<option value='{%$value.staff_id%}'> {%$value.staff_name%}</option>{%/foreach%}</select>";
   var newTdObj4=myNewRow.insertCell(3);
   newTdObj4.innerHTML="<select style='padding:0px; width:100px' name='dy1_2_"+rowsNum+"' >{%foreach from=$staff_lists key=key item=value%}<option value='{%$value.staff_id%}'> {%$value.staff_name%}</option>{%/foreach%}</select>";
   var newTdObj5=myNewRow.insertCell(4);
   newTdObj5.innerHTML="<select style='padding:0px; width:100px' name='dy2_1_"+rowsNum+"' >{%foreach from=$staff_lists key=key item=value%}<option value='{%$value.staff_id%}'> {%$value.staff_name%}</option>{%/foreach%}</select>";
   var newTdObj6=myNewRow.insertCell(5);
   newTdObj6.innerHTML="<select style='padding:0px; width:100px' name='dy2_2_"+rowsNum+"' >{%foreach from=$staff_lists key=key item=value%}<option value='{%$value.staff_id%}'> {%$value.staff_name%}</option>{%/foreach%}</select>";
   var newTdObj7=myNewRow.insertCell(6);
   newTdObj7.innerHTML="<select style='padding:0px; width:100px' name='dy3_1_"+rowsNum+"' >{%foreach from=$staff_lists key=key item=value%}<option value='{%$value.staff_id%}'> {%$value.staff_name%}</option>{%/foreach%}</select>";
   var newTdObj8=myNewRow.insertCell(7);
   newTdObj8.innerHTML="<select style='padding:0px; width:100px' name='dy3_2_"+rowsNum+"' >{%foreach from=$staff_lists key=key item=value%}<option value='{%$value.staff_id%}'> {%$value.staff_name%}</option>{%/foreach%}</select>";
   var newTdObj9=myNewRow.insertCell(8);
   newTdObj9.innerHTML="<select style='padding:0px; width:100px' name='dy4_1_"+rowsNum+"' >{%foreach from=$staff_lists key=key item=value%}<option value='{%$value.staff_id%}'> {%$value.staff_name%}</option>{%/foreach%}</select>";
   var newTdObj10=myNewRow.insertCell(9);
   newTdObj10.innerHTML="<select style='padding:0px; width:100px' name='dy4_2_"+rowsNum+"' >{%foreach from=$staff_lists key=key item=value%}<option value='{%$value.staff_id%}'> {%$value.staff_name%}</option>{%/foreach%}</select>";
   var newTdObj11=myNewRow.insertCell(10);
   newTdObj11.innerHTML="<select style='padding:0px; width:100px' name='dy5_1_"+rowsNum+"' >{%foreach from=$staff_lists key=key item=value%}<option value='{%$value.staff_id%}'> {%$value.staff_name%}</option>{%/foreach%}</select>";
   var newTdObj12=myNewRow.insertCell(11);
   newTdObj12.innerHTML="<select style='padding:0px; width:100px' name='dy5_2_"+rowsNum+"' >{%foreach from=$staff_lists key=key item=value%}<option value='{%$value.staff_id%}'> {%$value.staff_name%}</option>{%/foreach%}</select>";
   var newTdObj13=myNewRow.insertCell(12);
   newTdObj13.innerHTML="<select style='padding:0px; width:100px' name='dy6_1_"+rowsNum+"' >{%foreach from=$staff_lists key=key item=value%}<option value='{%$value.staff_id%}'> {%$value.staff_name%}</option>{%/foreach%}</select>";
   var newTdObj14=myNewRow.insertCell(13);
   newTdObj14.innerHTML="<select style='padding:0px; width:100px' name='dy6_2_"+rowsNum+"' >{%foreach from=$staff_lists key=key item=value%}<option value='{%$value.staff_id%}'> {%$value.staff_name%}</option>{%/foreach%}</select>";
  }
//窗口表格删除一行
  function removeRow(){
   var chkObj=document.getElementsByName("chkArr");
  //(chkObj[0].getAttribute("id").slice(6));return false;
   var tabObj=document.getElementById("myTab");
   for(var k=0;k<chkObj.length;k++){
    if(chkObj[k].checked){

     tabObj.deleteRow(k+1);

     k=-1;
    }
   }
  }
</script>

